/*
 * @Description:
 * @Author: dongjunhua
 * @Date: 2021-10-14 15:43:18
 * @LastEditors: dongjunhua
 * @LastEditTime: 2021-12-01 09:43:05
 */

const microAppOptions = [
  {
    name: 'MicroApp1',
    entry: 'http://localhost:3001/micro-app-1/',
    container: '#micro-container',
    activeRule: 'i/micro1'
  }
];

const generateMicroAppOptions = (microAppOptions = []) => {
  return microAppOptions.map(o => {
    const { name, entry, container, activeRule } = o;
    return {
      name,
      entry,
      container,
      activeRule: location => {
        return location.pathname.startsWith(
          `${process.env.VUE_APP_BASE_URI}${activeRule}`
        );
      }
    };
  });
};

export { microAppOptions, generateMicroAppOptions };
